home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cocktail Hour
/
image.iso
/
COCKTAIL.DIR
/
00054_Script_MaxPrint v3.0
< prev
next >
Wrap
Text File
|
1997-03-05
|
17KB
|
468 lines
-- MaxPrint version 3.0 --
on MaxPrint printType
cursor 4
-- the main script activates the procedures for text,tour or map printing --
global gPropFont,printer
--set the itemdelimiter to "~"
put "times new roman" into gPropFont
openxlib "pmatic.dll"
put PrintOMatic(mnew) into printer
printer(mRegister,"pmat130-067-01107")
printer(mReset)
if printType="map" then
printmap
else if printType="tour" then
printTour
else if printType="text" then
printText
end if
printer(mDispose)
closexlib "pmatic.dll"
cursor -1
end
on printMap
-- printMap prints the map and its "you are here" arrow. --
global w,h,print
if item 5 of field "MaxField"="metro" then
-- if there are maps which are portrait mode, which only happened in paris --
-- up to now, the word metro should be removed from the maxfield --
printer (mSetLandScapemode,TRUE)
else
printer (mSetLandScapemode,FALSE)
end if
set mapToPrint=the value of item 1 of field "MaxField"
put printer(mGetPageWidth) into w
put printer(mGetPageheight) into h
-- this part deals with printing the headline of the map --
set mapName=item 4 of field "maxfield"
printer (mSetMargins,1,1,1,1)
printer (mSetTextStyle,"bold,underline")
--set halve=w/2-(24*(the number of chars of mapName)/2)
set halve=printer(mGetPaperWidth)/2
printer (mSetTextSize,24)
--printer (mTextBox,halve,30,(24*(the number of chars of mapName)),54,FALSE)
printer (mSetTextJust,"centered")
printer (mdrawText,mapName,halve,40)
printer (mNewPage)
--set mapy=the height of cast mapToPrint
--set mapx=the width of cast mapToPrint
--set halve=w/2-mapX/2
if item 5 of field "MaxField"="metro" then
AppendBitMap(mapToPrint,1,55,"metro")
else
AppendBitMap(mapToPrint,1,55,"map")
end if
if item 2 of field "MaxField">-1 then
-----------------------------------------------------------------------------
-- printing an arrow on the map, is conditioned by the second item in the --
-- line ordering the print, not being -1. the parameters for the arrow are --
-- being held in the second and third parameters. The zero point is, --
-- currently set at 1,55 of the page's setup. --
-----------------------------------------------------------------------------
set arrowx=the value of item 2 of field "MaxField"
set arrowy=the value of item 3 of field "MaxField"
AppendBitMap("arrow",arrowx,arrowy,"arrow")
end if
printingProc
end
on appendBitMap TheBitMap,left,top,whatToPrint
------------------------------------------------------------------------------
-- TheBitMap is the name of the bitmap to be printed, left and top are its --
-- left and top coordinates and whatToPrint specifies which object is being --
-- printed for specific conditions --
-- w is the width of the screen. h is the height of the screen, forArrow is --
-- a variable set when a map is printed, for its arrow's coordinates --
------------------------------------------------------------------------------
global w,h,print,forArrowTop,forArrowLeft,prop
set y=the height of cast TheBitMap
set x=the width of cast TheBitMap
if whatToPrint="tour" then
----------------------------------------------------------------------------
-- if the bitmap is a tour, (or any other standard bitmap), the condition --
-- will prevent it from being bigger than the page. --
----------------------------------------------------------------------------
if x>w-5 then
set x=w-5
set y=y*w/x+30
end if
else if whatToPrint="map" then
------------------------------------------------------------------------------
-- if the bitmap is a map, it will be shrinked accorddingly from both sides --
-- to fit the page, and be set to be smaller then the page. --
------------------------------------------------------------------------------
set oldY=y
set oldX=x
set y=printer(mGetPageHeight)-top-60
set x=oldX*y/oldY+0.0
set prop=y/(oldY+0.0)
set left=(printer(mGetPageWidth))/2.0-x/2.0
set x=left+x
set y=top+y
set forArrowTop=top
set forArrowLeft=left
set left=integer(left)
set x=integer(x)
else if whatToPrint="metro" then
set oldY=y
set oldX=x
set x=printer(mGetPageWidth)
set y=oldY*x/oldX+0.0
set prop=x/(oldX+0.0)
set top=(printer(mGetPageHeight))/2.0-y/2.0
set x=left+x
set y=top+y
set forArrowTop=top
set forArrowLeft=left
set top=integer(top)
set y=integer(y)
else if whatToPrint="arrow" then
--global prop
-------------------------------------------------------------------------
-- if what to print is an arrow, left and top actually hold its center --
-- so all of the sides need to be calculated --
-------------------------------------------------------------------------
set left=left*prop
set top=top*prop
if item 5 of field "MaxField"="metro" then
--set top=top-20
--set left=left-5
end if
set left=integer(left-x/2+forArrowLeft)
set top=integer(top-y+forArrowTop)
set top=top-7
set x=integer(left+x)
set y=integer(top+y)
end if
printer (mPicture,the picture of member TheBitMap,left,top,x,y)
-- this sets the first textbox after the tour bitmap is printed --
if whatToPrint="tour" then
--printer (mTextBox,45,y+20,printer(mGetPageWidth),printer(mGetPageHeight),TRUE)
end if
end
on PrintText
-- printText prints text casts --
global w,h,gPropFont,printer
--if not objectP(printer) then
-- something went wrong, the Xtra was not instantiated
-- Alert "There is no currently selected printer. Printing features are disabled."
-- else
-- set the page margins
printer (mSetMargins,72,72,72,72)
put printer (mGetPageWidth) into w
put printer (mGetPageHeight) into h
MySetUp
-- set up the template page with one text box
printer (mNewPage)
printer (mTextBox,22,42,w,h,false)
-- this loop will append all of the casts specified in "MaxField"
repeat with cnt = 1 to the number of lines of field "MaxField"
set CastToPrint=integer(the value of item 1 of line cnt of field "Maxfield")
AppendStyledText (printer, CastToPrint, TRUE)
end repeat
printingProc
end
on printTour
-- printTour prints tours, which consist of both bitmaps and texts --
global printer
put printer (mGetPageWidth) into w
put printer (mGetPageHeight) into h
MySetUp
printer (mNewPage)
set mapName=line 1 of field "maxfield"
printer (mSetMargins,1,1,1,1)
printer (mSetTextStyle,"bold,underline")
--set halve=w/2-(24*(the number of chars of mapName)/2)
set halve=printer(mGetPaperWidth)/2
printer (mSetTextSize,24)
printer (mSetTextJust,"left")
printer (mdrawText,mapName,35,55)
-- this part sends the tour bitmap to the appendBitMap procedure --
set whatToPrint="tour"
set theBitMap=the value of line 2 of field "MaxField"
--set ww=the width of member theBitMap
appendBitMap theBitMap,235,70,"tour"
-- this part prints the text of the tour --
--if the number of lines of field "MaxField">3 then
--printer (mNewPage)
printer (mSetTextJust,"left")
printer (mSetTextStyle,"plain")
printer (mTextBox,35,60,w,h,TRUE)
printer (mSetTextSize,16)
repeat with i=3 to the number of lines of field "MaxField"
set tourtext=line i of field "MaxField"
AppendStyledText (printer,the value of tourtext, TRUE)
end repeat
--end if
printingProc
end
on MySetUp
-- MySetUp sets up the page in a standard mode, including logo and pages --
global printer,w,h,gPropFont
printer (mSetLandScapemode,FALSE)
printer (mSetMargins,72,72,72,72)
put printer(mGetPageWidth) into w
put printe